<!-- 咨询内容表  包括 所有聊天记录，问题 咨询 记录表单弹窗 -->
<form id="orderawnser-form" lay-filter="orderawnser-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">订单ID</label>
        <div class="layui-input-block">
            <input name="orderId" placeholder="请输入订单ID" type="text" class="layui-input" maxlength="20"  id="orderId"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员名称</label>
        <div class="layui-input-block">
            <input name="memberId" placeholder="请输入会员ID" type="text" class="layui-input layui-hide" maxlength="20"  id="memberId"
                   lay-verify="required"  required/>
            <input name="memberNickname" type="text" class="layui-input" maxlength="20"  id="memberNickname"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">老师ID</label>
        <div class="layui-input-block">
            <input name="teacherId" placeholder="请输入老师ID" type="text" class="layui-input layui-hide" maxlength="20"  id="teacherId"
                   lay-verify="required" required/>
            <input name="teacherName"  type="text" class="layui-input" maxlength="20"  id="teacherName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">开始时间</label>
        <div class="layui-input-block">
            <!--<input name="startDate" placeholder="请输入开始时间" type="text" class="layui-input" maxlength="20"  id="startDate"-->
                   <!--lay-verify="required" required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="startDate"  id="startDate"></label>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">结束时间</label>
        <div class="layui-input-block">
            <!--<input name="endDate" placeholder="请输入结束时间" type="text" class="layui-input" maxlength="20"  id="endDate"-->
                   <!--lay-verify="required" required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="endDate"  id="endDate"></label>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">问答内容JSON</label>
        <div class="layui-input-block">
            <input name="content" placeholder="请输入问答内容JSON" type="text" class="layui-input" maxlength="20"  id="content"
                   lay-verify="required" required/>
            <!--<pre id="json-renderer"></pre>-->
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">业务类型</label>
        <div class="layui-input-block">
            <input name="businessType" placeholder="请输入0-咨询，1-闪测，2-问答" type="text" class="layui-input layui-hide" maxlength="20"  id="businessType"
                   lay-verify="required" required/>
            <input name="strBusinessType"  type="text" class="layui-input" maxlength="20"  id="strBusinessType"
                   lay-verify="required" required/>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var orderawnser = admin.getTempData('t_orderawnser');
           if (orderawnser.method=="update"){
               $("#startDate").text(orderawnser.startDate);
               $("#endDate").text(orderawnser.endDate);
               if(orderawnser.businessType==0){
                   orderawnser.strBusinessType="咨询";
               }else if(orderawnser.businessType==1){
                   orderawnser.strBusinessType="闪测";
               }else if(orderawnser.businessType==2){
                   orderawnser.strBusinessType="问答";
               }

               // layer.open({
               //     type: 1,   //类型代表在页面加载显示
               //     content: $("#json-renderer"),
               //     success:function(){
               //         $("#json-renderer").jsonViewer(orderawnser.content);
               //     }
               // });
        	form.val('orderawnser-form', orderawnser);

            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('order/orderawnser/'+orderawnser.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
